package com.kexio.sms.enums;

/**
 * 短信类型枚举
 * 
 * @author Kexio Team
 * @since 1.0.0
 */
public enum SmsType {
    
    /**
     * 验证码短信
     */
    VERIFICATION("verification", "验证码短信"),
    
    /**
     * 通知短信
     */
    NOTIFICATION("notification", "通知短信"),
    
    /**
     * 营销短信
     */
    MARKETING("marketing", "营销短信"),
    
    /**
     * 系统短信
     */
    SYSTEM("system", "系统短信");
    
    private final String code;
    private final String description;
    
    SmsType(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static SmsType fromCode(String code) {
        for (SmsType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown SMS type code: " + code);
    }
}
